const inputEle = document.querySelector('input')
const containerEle = document.querySelector('.container')
inputEle.onkeyup = ()=>{
    const keyword = inputEle.value;
    if(keyword){
        $.ajax({
            type:'get',
            url:'http://localhost:3000/content',
            data:{
                keyword
            },
            success:function(data){
                if(data.length>0){
                    containerEle.style.display='block'
                    let html = ''
                    data.forEach((item)=>{
                        html += `<div>${item}</div>`
                    })
                    containerEle.innerHTML = html
                }else{
                    containerEle.style.display='none'

                }
            }
        })
    }else{
        containerEle.innerHTML = ''
        containerEle.style.display='none'
    }
}
 
